<%@ page contentType="text/html;charset=UTF-8"%>
<%@include file="../../common/sessionValidate.jsp" %>
<%@ page import="com.common.utils.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html lang="UTF-8">
  <head>
    <title>T_data_dic信息维护</title>
    <%@ include file="../../common/meta.jsp"%>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
	<link rel='stylesheet' type='text/css' href='<%=basePath%>css/factory/base.css'/>
    <link rel="stylesheet" href="<%=basePath%>css/my-bootstrap.css" media="screen"  id="tuserskin">
    <link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/switch/bootstrap3/highlight.css">
    <link rel="stylesheet" href="<%=basePath%>css/switch/bootstrap3/bootstrap-switch.css">
    <link rel="stylesheet" href="<%=basePath%>css/switch/bootstrap3/main.css" rel="stylesheet">
    <script type="text/javascript" src="<%= basePath %>js/jquery.cookie.js"></script>
  </head>
  <style>
	hr {
	    //margin-top:1px;
	    border-bottom: 1px solid #1BBC9B;
	}
  </style>
  <body>




  <div class="item_box box10">
	<div class="item_box_wp">
		<div class="voice_2">
			<ul>
				<li class="li1" id="li1">
					<div class="fold" style="display:none;">
						<span class="img"></span>
						<span class="txt">系统安全参数设置</span>
					</div>
					<div class="unfold" style="display:block">
						<dl>
							<dt></dt>
							<dd>
								<b>系统安全参数设置</b>
							</dd>
							<dd>

							<hr>[1]、系统熔断(熔断后不能登录)
							<br>说明：熔断=RD; 正常=ZC
							<br><div class="switch" data-on="danger" data-off="primary"  data-on-label="开启" data-off-label="关闭"><input type="checkbox" checked /></div>

								<div id="xtrdid">
								</div>
                            <hr>[2]、金融机构开关<br>
								<div id="jrjgid">
								</div>
							<hr>[3]、核心企业开关<br>
								<div id="hxqyid">
								</div>

							</dd>
						</dl>
					</div>
				</li>
				<li class="li2">
					<div class="fold">
						<span class="img"></span>
						<span class="txt">产品参数设置</span>
					</div>
					<div class="unfold">
						<dl>
							<dt> </dt>
							<dd>
								<b>产品参数设置</b>
							</dd>
							<dd>通过APP应用内按钮或浏览器网页按钮点击并发起IP通话、运营商线路通话服务，减少用户交互，提升用户体验</dd>
						</dl>
					</div>
				</li>
				<li class="li3">
					<div class="fold">
						<span class="img"></span>
						<span class="txt">系统参数设置</span>
					</div>
					<div class="unfold">
						<dl>
							<dt> </dt>
							<dd>
								<b>系统参数设置</b>
							</dd>
							<dd>无论是智能终端、浏览器模式，通过APP或者网页发起通话，接通方为手机用户或固话用户，常见集成至与企业服务相关的移动应用、企业客服座席。</dd>
						</dl>
					</div>
				</li>
				<li class="li4">
					<div class="fold">
						<span class="img"></span>
						<span class="txt">金融机构参数设置</span>
					</div>
					<div class="unfold">
						<dl>
							<dt><img src="images/img50.png" /></dt>
							<dd>
								<b>金融机构参数设置<a href="http://down.admin5.com/info/">查看接口文档>></a></b>
							</dd>
							<dd>

多萨法第三方的撒

							</dd>
						</dl>
					</div>
				</li>
				<li class="li5">
					<div class="fold">
						<span class="img"></span>
						<span class="txt">核心企业参数设置</span>
					</div>
					<div class="unfold">
						<dl>
							<dt><img src="images/img51.png" /></dt>
							<dd>
								<b>核心企业参数设置</b>
							</dd>
							<dd>基于互联网纯网络通话，无运营商和地域限制，拥有更清晰的语音质量，支持语音三方密钥的加密传输</dd>
						</dl>
					</div>
				</li>

			</ul>
		</div>
	</div>
</div>

  </body>
</html>

<script src="<%=basePath%>js/bootstrap.min.js"></script>
<script src="<%=basePath%>js/jquery-1.10.2/jquery.min.js"></script>
<script src="<%=basePath%>js/my-jquery-curd.js"></script>
<script src="<%=basePath%>js/factory/base.js"></script>
<script src="<%=basePath%>js/switch/bootstrap-switch.js"></script>


<script type="text/javascript">

$().ready(function(){
	//1、初始化数据显示
	Search1(0);
	//Search2(0);
	//Search3(0);

}) //end funciton read;

//根据查询条件，查询列表数据并显示
function Search1(startIndex){
	var pageSize = 1000 ;//document.getElementById("pageSize").value;
	var condition = ""; //$("#form1").serialize();
	var url = "<%=basePath%>t_data_dic/getAllT_data_dic?startIndex="+startIndex+"&data_group=SYSTEM_RD&pageSize="+pageSize+"&"+condition+"&time="+Math.random();
	//alert(url);
	$.getJSON(url, function (data){
		$("#xtrdid").html("");
		var str='';
		//1、表格行内容输出
	    $.each(data.items, function(i,item){
	    	str+='';
			str+='当前状态=<input type="text" size="2" id="'+item.data_no+'" value="'+item.data_name+'">';
			str+='<div class="switch" data-on="danger" data-off="primary"  data-on-label="开启" data-off-label="关闭"><input type="checkbox" checked /></div>'
			str+='<button type="button" onclick="javascript:turnOffOrOn(\'RD\',\''+item.data_no+'\')" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton">开启熔断</button>';
			str+='<button type="button"  onclick="javascript:turnOffOrOn(\'ZC\',\''+item.data_no+'\')" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton">关闭熔断</button>';
		});//end each data;
	    $("#xtrdid").html(str);
	    $('[type="checkbox"]').bootstrapSwitch();
	    Search2(0);

    })//end getJSON;
}

//根据查询条件，查询列表数据并显示
function Search2(startIndex){
	var pageSize = 1000 ;//document.getElementById("pageSize").value;
	var condition = ""; //$("#form1").serialize();
	var url = "<%=basePath%>t_data_dic/getAllT_data_dic?startIndex="+startIndex+"&data_group=BANK_INTERFACE_SWITCH&pageSize="+pageSize+"&"+condition+"&time="+Math.random();
	//alert(url);
	$.getJSON(url, function (data){
		$("#jrjgid").html("");
		var str2='';

		//1、表格行内容输出
	    $.each(data.items, function(i,item){
			str2+= item.data_type_name+'当前状态=<input type="text" size="2" id=\"'+item.data_no+'\" value=\"'+item.data_name+'\">';
			str2+='<input type="checkbox" checked /><button type="button" onclick="javascript:turnOffOrOn(\'true\',\''+item.data_no+'\')" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton">开启</button>';
			str2+='<button type="button"  onclick="javascript:turnOffOrOn(\'false\',\''+item.data_no+'\')" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton">关闭</button>';
			str2+='<br>';
		});//end each data;
	    $("#jrjgid").html(str2);
	    $('[type="checkbox"]').bootstrapSwitch();

	    Search3(0);
    })//end getJSON;
}

//根据查询条件，查询列表数据并显示
function Search3(startIndex){
	var pageSize = 1000 ;//document.getElementById("pageSize").value;
	var condition = ""; //$("#form1").serialize();
	var url = "<%=basePath%>t_data_dic/getAllT_data_dic?startIndex="+startIndex+"&data_group=ERP_INTERFACE_SWITCH&pageSize="+pageSize+"&"+condition+"&time="+Math.random();
	//alert(url);
	$.getJSON(url, function (data){
		$("#hxqyid").html("");
        var str3 ='';
		//1、表格行内容输出
	    $.each(data.items, function(i,item){
			str3+= item.data_type_name+'当前状态=<input type="text" size="2" id=\"'+item.data_no+'\" value=\"'+item.data_name+'"\>';
			str3+='<input type="checkbox" checked /><button type="button" onclick="javascript:turnOffOrOn(\'true\',\''+item.data_no+'\')" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton">开启</button>';
			str3+='<button type="button"  onclick="javascript:turnOffOrOn(\'false\',\''+item.data_no+'\')" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton">关闭</button>';
			str3+='<br>';
		});//end each data;
		$("#hxqyid").html(str3);
	    $('[type="checkbox"]').bootstrapSwitch();
    })//end getJSON;
}

//操作后，更新页面上值为新值
function turnOffOrOn(flag, codeno){
	alert("======flag="+flag+";codeno="+codeno);
	//$("#"+codeno).attr(flag);
	//设置熔断值为选中的值；
	alert("------设置熔断value="+document.getElementById(codeno).value);
	document.getElementById(codeno).value = flag;
	var url = "<%=basePath%>t_data_dic/updateT_data_dicByDatano?time="+Math.random();
    //var postData = $("#ffAdd").serializeArray();
    var postData = {data_no:codeno,data_name:flag};
    alert(postData);
   	$.post(url, postData, function (data) {
    	//var data = $.parseJSON(json);
        if (data.result=="success") {
          	showSuccessTips("恭喜修改成功", "提示");
        }
        else {
        	$("#editSaveButton").removeAttr("disabled");
        	showErrorTips("修改数据失败!", "错误信息：");
        }
    }).error(function () {
    	$("#editSaveButton").removeAttr("disabled");
    	showErrorTips("修改数据失败!", "错误信息：");
    });
}

</script>
<script>
$(function(argument) {
  $('[type="checkbox"]').bootstrapSwitch();
})
</script>